/**
 * 
 */
package com.example.sql;

import android.annotation.SuppressLint;
import android.content.Context;
import android.database.DatabaseErrorHandler;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * @author Administrator
 *
 */
public class SqlHelp extends SQLiteOpenHelper {
	static int Ver = 1;// 数据库的版本号
	public static String TableUser = "User";// 用户表
	public static String TableNumber = "Number";// 信息表
	public static String DBName = "Np.db";// 数据库名字
	
	public SqlHelp(Context context, String name, CursorFactory factory,
			int version) {
		super(context, name, factory, version);
		// TODO Auto-generated constructor stub
	}
	
	public SqlHelp(Context context, String name) {
		this(context, name,null,Ver);
		// TODO 自动生成的构造函数存根
	}
	

	

	/* (non-Javadoc)
	 * @see android.database.sqlite.SQLiteOpenHelper#onCreate(android.database.sqlite.SQLiteDatabase)
	 */
	@Override
	public void onCreate(SQLiteDatabase arg0) {
		// TODO Auto-generated method stub
		// TODO 自动生成的方法存根
		String sql = "Create Table "
				+ TableUser
				+ "(id integer primary key autoincrement,username varchar(100),password varchar(100))";
		arg0.execSQL(sql);
		//id  姓名  电话  短号  班级  qq  微信
		sql = "Create Table "
				+ TableNumber
				+ "(id integer primary key autoincrement,name varchar(100),"
				+ "phoneNumber varchar(100),shortNumber varchar(100),grade varchar(100)"
				+ ",qq varchar(100),weixin varchar(100))";
		arg0.execSQL(sql);
	}

	/* (non-Javadoc)
	 * @see android.database.sqlite.SQLiteOpenHelper#onUpgrade(android.database.sqlite.SQLiteDatabase, int, int)
	 */
	@Override
	public void onUpgrade(SQLiteDatabase arg0, int arg1, int arg2) {
		// TODO Auto-generated method stub

	}

}
